package ui.activity;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.fy.fyzf.R;
import com.fy.fyzf.base.BaseActivity;
import com.fy.fyzf.bean.ExChangeRecordBean;
import com.fy.fyzf.bean.ExchangeBean;
import com.fy.fyzf.bean.ExchangeDetailBean;
import com.fy.fyzf.bean.IntegralRecordBean;
import com.fy.fyzf.bean.IntegralStoreBean;
import com.fy.fyzf.bean.RulesBean;
import com.fy.fyzf.glideUtils.GlideUtils;
import com.fy.fyzf.presenter.IntergralPresenter;
import com.fy.fyzf.view.IntergralCallBack;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ExChangeDetailActivity extends BaseActivity<IntergralPresenter> implements IntergralCallBack {


    @BindView(R.id.iv_logo)
    ImageView ivLogo;
    @BindView(R.id.tv_name)
    TextView tvName;
    @BindView(R.id.tv_status)
    TextView tvStatus;
    @BindView(R.id.tv_integral)
    TextView tvIntegral;
    @BindView(R.id.tv_time)
    TextView tvTime;
    @BindView(R.id.tv_number)
    TextView tvNumber;
    @BindView(R.id.tv_people)
    TextView tvPeople;

    @Override
    protected IntergralPresenter createPresenter() {
        return new IntergralPresenter(this);
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_ex_change_detail;
    }

    @Override
    public void initData() {
        super.initData();
        setTitleName("兑换详情");
        int id = getIntent().getIntExtra("id", 0);
        ExchangeBean exchangeBean = new ExchangeBean();
        exchangeBean.setExchangeId(id);
        mPresenter.getExchangeDetail(exchangeBean);
    }

    @Override
    public void getIntegralListSuccess(IntegralStoreBean integralStoreBean) {

    }

    @Override
    public void exchangeSuccess(ExchangeBean exchangeBean) {

    }

    @Override
    public void getExchangeDetailSuccess(ExchangeDetailBean exchangeDetailBean) {
        GlideUtils.loadImage(exchangeDetailBean.getMallUrl(),ivLogo);
        tvName.setText(exchangeDetailBean.getMallTitle());
        if (exchangeDetailBean.getExchangeStart() == 0) {
            tvStatus.setText("已生效");
        } else {
            tvStatus.setText("已失效");
        }
        tvNumber.setText(exchangeDetailBean.getSerialNumber()+"");
        tvIntegral.setText(exchangeDetailBean.getMallIntegral()+"分");
        tvTime.setText(exchangeDetailBean.getCreateTime());
        tvPeople.setText(exchangeDetailBean.getUserName()+exchangeDetailBean.getUserMobile());
    }

    @Override
    public void getExchangeRecordSuccess(ExChangeRecordBean exChangeRecordBean) {

    }

    @Override
    public void getIntegralRecordListSuccess(IntegralRecordBean integralRecordBean) {

    }

    @Override
    public void getRulesSuccess(List<RulesBean> list) {

    }

}